package com.qunar.sy.demo.response;

public class BaseResponse {
    /**
     * 成功0,失败-1
     */
    private int code;

    private String message;

    private Object data;

    public BaseResponse(){}

    public BaseResponse(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static BaseResponse create(int code, String message, Object data) {
        return new BaseResponse(code, message, data);
    }

    public static BaseResponse success(Object data) {
        return create(0, "", data);
    }

    public static BaseResponse fail(String message) {
        return create(-1, message, null);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
